package com.cw.demo.tomcat.http;

import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;

/**
 * TODO
 *
 * @author chenw
 * @date 2021/2/3
 */
public class Request {
    //获取uri
    private String uri;
    //获取请求方法，这里致谢get和post GET or POST
    private String method;

    public Request(InputStream inputStream) {
        try {
            BufferedReader read = new BufferedReader(new InputStreamReader(inputStream, "utf-8"));
            String [] data = read.readLine().split(" ");
            this.uri = data[1];
            this.method = data[0];
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public String getUri() {
        return uri;
    }

    public void setUri(String uri) {
        this.uri = uri;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }
}
